<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: GalleryHelper</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">GalleryHelper</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/app/helpers/gallery_helper_rb.html">
                app/helpers/gallery_helper.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000019">writeDelicious</a>&nbsp;&nbsp;
      <a href="#M000018">writeDiggIt</a>&nbsp;&nbsp;
      <a href="#M000020">writeReddit</a>&nbsp;&nbsp;
      <a href="#M000017">writeSocialBookmarks</a>&nbsp;&nbsp;
      <a href="#M000016">writeTags</a>&nbsp;&nbsp;
      <a href="#M000021">writeTechnorati</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">writeDelicious</span><span class="method-args">(url,title)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method returns a link to bookmark the current photo at del.icio.us
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
    <span class="ruby-comment cmt"># File app/helpers/gallery_helper.rb, line 27</span>
27:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">writeDelicious</span>(<span class="ruby-identifier">url</span>,<span class="ruby-identifier">title</span>)
28:     <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'&lt;a href='</span><span class="ruby-value str">'http://del.icio.us.com/post?url='</span><span class="ruby-operator">+</span><span class="ruby-identifier">url</span><span class="ruby-operator">+</span><span class="ruby-value str">'&amp;title='</span><span class="ruby-operator">+</span><span class="ruby-identifier">title</span><span class="ruby-operator">+</span><span class="ruby-value str">''</span><span class="ruby-value str">' title='</span><span class="ruby-value str">'Delicious'</span><span class="ruby-value str">' &gt;&lt;img src='</span><span class="ruby-value str">'/images/delicious.png'</span><span class="ruby-value str">' alt='</span><span class="ruby-value str">'Delicious'</span><span class="ruby-value str">' title='</span><span class="ruby-value str">'Digg'</span><span class="ruby-value str">' border='</span><span class="ruby-value str">'0'</span><span class="ruby-value str">'&gt;&lt;/a&gt;'</span>
29:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000018" class="method-detail">
        <a name="M000018"></a>

        <div class="method-heading">
          <a href="#M000018" class="method-signature">
          <span class="method-name">writeDiggIt</span><span class="method-args">(url,title)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method returns a link to bookmark the current photo at diggit
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000018-source">
<pre>
    <span class="ruby-comment cmt"># File app/helpers/gallery_helper.rb, line 23</span>
23:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">writeDiggIt</span>(<span class="ruby-identifier">url</span>,<span class="ruby-identifier">title</span>)
24:     <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'&lt;a href='</span><span class="ruby-value str">'http://digg.com/submit?phase=2&amp;url='</span><span class="ruby-operator">+</span><span class="ruby-identifier">url</span><span class="ruby-operator">+</span><span class="ruby-value str">'&amp;title='</span><span class="ruby-operator">+</span><span class="ruby-identifier">title</span><span class="ruby-operator">+</span><span class="ruby-value str">''</span><span class="ruby-value str">' title='</span><span class="ruby-value str">'Digg'</span><span class="ruby-value str">' &gt;&lt;img src='</span><span class="ruby-value str">'/images/digg.png'</span><span class="ruby-value str">' alt='</span><span class="ruby-value str">'Digg'</span><span class="ruby-value str">' title='</span><span class="ruby-value str">'Digg'</span><span class="ruby-value str">' border='</span><span class="ruby-value str">'0'</span><span class="ruby-value str">'&gt;&lt;/a&gt;'</span>
25:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <a href="#M000020" class="method-signature">
          <span class="method-name">writeReddit</span><span class="method-args">(url,title)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method returns a link to bookmark the current photo at reddit
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000020-source">
<pre>
    <span class="ruby-comment cmt"># File app/helpers/gallery_helper.rb, line 31</span>
31:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">writeReddit</span>(<span class="ruby-identifier">url</span>,<span class="ruby-identifier">title</span>)
32:     <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'&lt;a href='</span><span class="ruby-value str">'http://reddit.com/submit?url='</span><span class="ruby-operator">+</span><span class="ruby-identifier">url</span><span class="ruby-operator">+</span><span class="ruby-value str">'&amp;title='</span><span class="ruby-operator">+</span><span class="ruby-identifier">title</span><span class="ruby-operator">+</span><span class="ruby-value str">''</span><span class="ruby-value str">' title='</span><span class="ruby-value str">'Reddit'</span><span class="ruby-value str">' &gt;&lt;img src='</span><span class="ruby-value str">'/images/reddit.png'</span><span class="ruby-value str">' alt='</span><span class="ruby-value str">'Reddit'</span><span class="ruby-value str">' title='</span><span class="ruby-value str">'Reddit'</span><span class="ruby-value str">' border='</span><span class="ruby-value str">'0'</span><span class="ruby-value str">'&gt;&lt;/a&gt;'</span>
33:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000017" class="method-detail">
        <a name="M000017"></a>

        <div class="method-heading">
          <a href="#M000017" class="method-signature">
          <span class="method-name">writeSocialBookmarks</span><span class="method-args">(id,title)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method writes a section that allows bookmarking of a photo Supported
sites are Diggit, del.icio.us, reddit and Technorati
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000017-source">
<pre>
    <span class="ruby-comment cmt"># File app/helpers/gallery_helper.rb, line 17</span>
17:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">writeSocialBookmarks</span>(<span class="ruby-identifier">id</span>,<span class="ruby-identifier">title</span>)
18:     <span class="ruby-identifier">title</span> = <span class="ruby-identifier">title</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot; &quot;</span>,<span class="ruby-value str">&quot;+&quot;</span>)
19:     <span class="ruby-identifier">url</span> = <span class="ruby-identifier">url_for</span>(<span class="ruby-identifier">:controller=</span><span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;gallery&quot;</span>,<span class="ruby-identifier">:action=</span><span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;list&quot;</span>,<span class="ruby-identifier">:id=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">id</span>,<span class="ruby-identifier">:only_path=</span><span class="ruby-operator">&gt;</span><span class="ruby-keyword kw">false</span>)
20:     <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'Bookmark: '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">writeDiggIt</span>(<span class="ruby-identifier">url</span>,<span class="ruby-identifier">title</span>)<span class="ruby-operator">+</span><span class="ruby-value str">' '</span><span class="ruby-operator">+</span><span class="ruby-identifier">writeDelicious</span>(<span class="ruby-identifier">url</span>,<span class="ruby-identifier">title</span>)<span class="ruby-operator">+</span><span class="ruby-value str">' '</span><span class="ruby-operator">+</span><span class="ruby-identifier">writeReddit</span>(<span class="ruby-identifier">url</span>,<span class="ruby-identifier">title</span>)<span class="ruby-operator">+</span><span class="ruby-value str">' '</span><span class="ruby-operator">+</span><span class="ruby-identifier">writeTechnorati</span>(<span class="ruby-identifier">url</span>)<span class="ruby-operator">+</span><span class="ruby-value str">' '</span>
21:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000016" class="method-detail">
        <a name="M000016"></a>

        <div class="method-heading">
          <a href="#M000016" class="method-signature">
          <span class="method-name">writeTags</span><span class="method-args">(tags)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method writes Tags for a photo along with links to similar photos
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000016-source">
<pre>
    <span class="ruby-comment cmt"># File app/helpers/gallery_helper.rb, line 3</span>
 3:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">writeTags</span>(<span class="ruby-identifier">tags</span>)
 4:     <span class="ruby-identifier">tagList</span> = <span class="ruby-value str">''</span>
 5:     <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">tags</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">tags</span>.<span class="ruby-identifier">empty?</span>
 6:       <span class="ruby-identifier">tagList</span> = <span class="ruby-value str">'Tags: '</span>
 7:       <span class="ruby-identifier">tags</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tag</span><span class="ruby-operator">|</span>
 8:         <span class="ruby-identifier">tagList</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">link_to</span>(<span class="ruby-identifier">tag</span>.<span class="ruby-identifier">raw</span>,{<span class="ruby-identifier">:controller</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;tags&quot;</span>,<span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;list&quot;</span>,<span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">tag</span>.<span class="ruby-identifier">raw</span>})<span class="ruby-operator">+</span><span class="ruby-value str">' '</span>
 9:       <span class="ruby-keyword kw">end</span>
10:     <span class="ruby-keyword kw">else</span>
11:       <span class="ruby-identifier">tagList</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">'Tags: &lt;i&gt;None&lt;/i&gt;'</span>
12:     <span class="ruby-keyword kw">end</span>
13:     <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tagList</span>
14:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">writeTechnorati</span><span class="method-args">(url)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method returns a link to bookmark the current photo at technorati
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
    <span class="ruby-comment cmt"># File app/helpers/gallery_helper.rb, line 35</span>
35:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">writeTechnorati</span>(<span class="ruby-identifier">url</span>)
36:     <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'&lt;a href='</span><span class="ruby-value str">'http://technorati.com/faves?add='</span><span class="ruby-operator">+</span><span class="ruby-identifier">url</span><span class="ruby-operator">+</span><span class="ruby-value str">' title='</span><span class="ruby-value str">'Technorati'</span><span class="ruby-value str">' &gt;&lt;img src='</span><span class="ruby-value str">'/images/technorati.png'</span><span class="ruby-value str">' alt='</span><span class="ruby-value str">'Technorati'</span><span class="ruby-value str">' title='</span><span class="ruby-value str">'Technorati'</span><span class="ruby-value str">' border='</span><span class="ruby-value str">'0'</span><span class="ruby-value str">'&gt;&lt;/a&gt;'</span>
37:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>